﻿Public Class Gestion_Rest

    Public Function listar() As Collection
        Dim dao As New RestauranteDAO
        Return dao.listar()
    End Function

    Public Function insertar(ByVal nombre As String, ByVal tipo_comida As String, ByVal distrito As String, ByVal direccion As String, ByVal ruc As String) As Restaurante

        Dim modelo As New Restaurante()
        modelo.nombre = nombre
        modelo.tipo_comida = tipo_comida
        modelo.distrito = distrito
        modelo.direccion = direccion
        modelo.ruc = ruc

        Dim dao As New RestauranteDAO
        Return dao.insertar(modelo)
    End Function

    Public Sub actualizar(ByVal nombre As String, ByVal tipo_comida As String, ByVal distrito As String, ByVal direccion As String, ByVal ruc As String, ByVal idrestaurant As Integer)

        Dim modelo As New Restaurante()
        modelo.nombre = nombre
        modelo.tipo_comida = tipo_comida
        modelo.distrito = distrito
        modelo.direccion = direccion
        modelo.ruc = ruc
        modelo.idrestaurant = idrestaurant

        Dim dao As New RestauranteDAO
        dao.actualizar(modelo)
    End Sub

    Public Sub actualizarxname(ByVal nombre As String, ByVal tipo_comida As String, ByVal distrito As String, ByVal direccion As String, ByVal ruc As String)

        Dim modelo As New Restaurante()
        modelo.nombre = nombre
        modelo.tipo_comida = tipo_comida
        modelo.distrito = distrito
        modelo.direccion = direccion
        modelo.ruc = ruc

        Dim dao As New RestauranteDAO
        dao.actualizarxname(modelo)
    End Sub

    Public Sub eliminar(ByVal idrestaurant As Integer)
        Dim dao As New RestauranteDAO
        dao.eliminar(idrestaurant)
    End Sub

    Public Function obtener(ByVal idrestaurant As Integer) As Restaurante
        Dim dao As New RestauranteDAO
        Return dao.obtener(idrestaurant)
    End Function

    Public Function obtener2(ByVal nombre As String) As Restaurante
        Dim dao As New RestauranteDAO
        Return dao.obtener2(nombre)
    End Function

End Class
